package dancrawler.server;

import java.util.ArrayList;

public class Cell {

    private int xCellSize;
    private int yCellSize;
    private int xCellCoord;
    private int yCellCoord;
    private boolean isConnected;
    private boolean isUsed;
    private GeneratedTile[][] cellTiles;
    private ArrayList<Cell> connectedTo;
    
    public Cell(int xCellSize,int yCellSize, int cellAmount,int xCellCoord, int yCellCoord) {
        this.xCellSize=xCellSize;
        this.yCellSize=yCellSize;
        this.xCellCoord=xCellCoord;
        this.yCellCoord=yCellCoord;
        connectedTo = new ArrayList<>();
        cellTiles=new GeneratedTile[xCellSize][yCellSize];
    }

    public int getxCellCoord() {
        return xCellCoord;
    }

    public int getyCellCoord() {
        return yCellCoord;
    }
    
    public void connectTo(Cell c){
        connectedTo.add(c);
    }
    public ArrayList getConnected(){
        return connectedTo;
    }
   
    public void setConnected() {
        isConnected=true;
    }

    public boolean isConnected() {
        return isConnected;
    }
    
    public void setUsed(){
        isUsed=true;
    }
    
    public boolean isUsed(){
        return isUsed;
    }
    
    public void setCellTiles(GeneratedTile[][] ct){
        for (int i=0;i<ct.length;i++){
            for (int j=0;j<ct[i].length;j++){
                cellTiles[i][j]=ct[i][j];
            }
        }
    }
    
    public GeneratedTile[][] getCellTiles(){
        return cellTiles;
    }
    
    public void setEmptyCell(){
        GeneratedTile[][] t = new GeneratedTile[xCellSize][yCellSize];
        for (int i=0;i<cellTiles.length;i++){
            for (int j=0;j<cellTiles[i].length;j++){
                cellTiles[i][j]=t[i][j];
            }
        }
    }
    
    
}
